import json
import jieba
from tqdm import tqdm

with open("./origin.json", "r", encoding="utf-8") as f:
    records = json.load(f)["RECORDS"]

"""
    {
      "skuDesc": "南孚 7号 电池 16粒/盒",
      "skuName": null,
      "skuShortName": "电池"
    },

"""

for record in tqdm(records):
    desc = record.get("skuDesc")
    name = record.get("skuName")
    short = record.get("skuShortName")
    if not desc:
        desc = ""
    if not name:
        name = ""
    if short in desc or short in name:
        continue
    else:
        short_cuts = jieba.cut(short)
        for short_cut in short_cuts:
            if short_cut in desc or short_cut in name:
                continue

    print(f"desc=[{desc}], name=[{name}]")
